package com.eurasia.assignment.infrastructure.client.hoj.resources;

import com.eurasia.assignment.controller.dto.CreateCodeSubmissionResponse;
import com.eurasia.assignment.domain.hoj.CodeInfo;
import com.eurasia.assignment.service.port.out.dto.CreateFullCaseJudgementRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.eurasia.assignment.config.FeignConfig;
import com.eurasia.assignment.controller.dto.ProblemQuery;

@FeignClient(name = "target-service", url = "${target.service.base-url}", configuration = FeignConfig.class)
public interface HOJResourceFeignClient {
    @RequestMapping(method = RequestMethod.GET, value = "/api/get-problem-list")
    ResponseEntity<String> getProblemList(@SpringQueryMap ProblemQuery query);

    @RequestMapping(method = RequestMethod.GET, value = "/api/get-problem-detail")
    ResponseEntity<String> getProblemDetail(@RequestParam("problemId") String id);

    @RequestMapping(method = RequestMethod.POST, value = "/api/submit-problem-test-judge")
    ResponseEntity<CreateCodeSubmissionResponse> createCodeSubmission(@RequestBody CodeInfo body);

    @RequestMapping(method = RequestMethod.GET, value = "/api/get-test-judge-result")
    ResponseEntity<String> getTestJudgementResult(@RequestParam("testJudgeKey") String testJudgeKey);

    @RequestMapping(method = RequestMethod.POST, value = "/api/submit-problem-judge")
    ResponseEntity<String> createFullCaseJudgement(@RequestBody CreateFullCaseJudgementRequest request);

    @RequestMapping(method = RequestMethod.GET, value = "/api/get-submission-detail")
    ResponseEntity<String> fetchFullCaseJudgementConclusionResult(@RequestParam("submitId") Long submitId);

    @RequestMapping(method = RequestMethod.GET, value = "/api/get-all-case-result")
    ResponseEntity<String> fetchFullCaseJudgementDetailedResult(@RequestParam("submitId") Long submitId);
}
